feat: add Grok 4.5 model support and fix xAI reasoning format#867
feat: add Grok 4.5 model support and fix xAI reasoning format#867navedmerchant wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR changes the default xAI model from ChangesxAI grok-4.5 model and reasoning fix
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant XAIHandler
participant ResponsesAPI
Caller->>XAIHandler: createMessage with reasoning effort
XAIHandler->>XAIHandler: Build reasoning.effort payload
XAIHandler->>ResponsesAPI: Send formatted request
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add grok-4.5 model definition with 500K context window, .00/.00
input/output pricing, /bin/sh.50 cache pricing, and configurable reasoning
(low/medium/high, default high). Update xaiDefaultModelId from
grok-4.20 to grok-4.5 as the new flagship model.
Fix a latent bug in the xAI handler where reasoning effort was sent in
Chat Completions format (reasoning: { reasoning_effort }) instead of
the Responses API format (reasoning: { effort }). This affected
grok-3-mini and would have broken grok-4.5's configurable reasoning.
Update tests to cover the reasoning format fix and add grok-4.5
reasoning support tests. Update e2e test primary model to grok-4.5.
Fixes #866
eb40ce1 to
99adf9a
Compare

Related GitHub Issue
Closes: #866
Description
Grok 4.5 was publicly released on July 9, 2026 as xAI's new flagship model. This PR adds support for it in the xAI provider and fixes a latent reasoning format bug.
Key implementation details:
New model definition (
packages/types/src/providers/xai.ts): Addedgrok-4.5with 500K context window, $2.00/$6.00 input/output pricing, $0.50 cache pricing, and configurable reasoning effort (["low", "medium", "high"], default"high"). UpdatedxaiDefaultModelIdfromgrok-4.20togrok-4.5.Reasoning format bug fix (
src/api/providers/xai.ts): The xAI Responses API expectsreasoning: { effort: "high" }format, but the handler was passingreasoning: { reasoning_effort: "high" }(Chat Completions format). This was a latent bug that affectedgrok-3-miniand would have broken grok-4.5's configurable reasoning. The handler now converts from the OpenAI params shape to the Responses API{ effort }format.Test updates (
src/api/providers/__tests__/xai.spec.ts): Fixed the existing grok-3-mini reasoning test to expect the correct{ effort }format. Added two new tests for grok-4.5 — one verifying default high reasoning effort, one verifying custom low effort.E2e test update (
apps/vscode-e2e/src/suite/providers/xai.test.ts): Updated the primary model ID fromgrok-4.20togrok-4.5.Test Procedure
Unit tests (all passing):
cd src && npx vitest run api/providers/__tests__/xai.spec.ts— 17 tests pass (15 original + 2 new grok-4.5 tests)cd src && npx vitest run api/transform/__tests__/model-params.spec.ts api/transform/__tests__/reasoning.spec.ts shared/__tests__/api.spec.ts— 161 tests passcd src && npx vitest run api/transform/__tests__/openai-format.spec.ts— 56 tests passcd src && npx vitest run shared/__tests__/ProfileValidator.spec.ts— 28 tests passcd packages/types && npx vitest run— 230 tests passLint & type-check (pre-commit/pre-push hooks):
--max-warnings=0across all packagestsc --noEmitpasses for@roo-code/types,@roo-code/vscode-e2e, andzoo-codePre-Submission Checklist
descriptionfield.Screenshots / Videos
N/A — no UI changes. The new
grok-4.5model will automatically appear in the xAI provider model dropdown.Documentation Updates
Additional Notes
The reasoning format bug (
reasoning_effortvseffort) was pre-existing and would have silently caused grok-4.5 to ignore the user's reasoning effort setting, always falling back to the model's default. The xAI API likely silently ignores unrecognized fields in thereasoningobject, so this wouldn't have caused errors — just incorrect behavior.Get in Touch
N/A
Summary by CodeRabbit
grok-4.5instead ofgrok-4.20.grok-4.5plus default and custom reasoning-effort behavior.